#!/usr/bin/python
# -*- coding=utf-8 -*-
from urllib.request import urlopen
print("hello", "world")
# name = input()
name ="333"
print(type(name))
print(type(int(name)))
print('I\'m \"OK\"!')
print(r'\\\t\\')
'''
这是一段注释
'''
"""
这也是一段注释
"""
print(10/3)
print(10//3)

list1=[]
print(list1.__len__())
print(len(list1))

tuple1 = (1)
print(tuple1)
print(type(tuple1))

tuple1 = (1,)
print(tuple1)
print(type(tuple1))

tuple1=(1, 2, [3,4])
print(tuple1[2][1])
tuple1[2][1] = 20
print(tuple1[2][1])
print("-------------------------------")
set1=set([10, 9, 9, 8, 6, 3])
print(set1)

def dummy():
    pass

dummy()

list2 = [x * x for x in range(1, 11) if x % 2 == 0]
print(list2)

list3 = [m + n for m in 'ABC' for n in 'XYZ']
print(list3)

# list4=[str(x)+""+x*y for x in range(1, 10) for y in range(1, x+1)]
# print(list4)

g = (x * x for x in range(10))
print(type(g))
# for i in range(10):
#     print(next(g), end=" ")
for a in g:
    print(a, end=" ")
print()
print("------------绝对值------------------------")
var1 = abs(-10)
print(var1)

func=abs
var2 = func(-1)
print(var2)

def add_func(a, b, f):
    return f(a)+f(b)
print(add_func(-1, -3, abs))

def my_f(x):
    return x*x
r=map(my_f, [1, 2, 3, 4])
print(list(r))

from functools import reduce
def fn(x, y):
    return x * 10 + y
r=reduce(fn, [1, 2, 3, 4])
print(r)


print('\n'.join([' '.join(['%s*%s=%-2s' % (y,x,x*y) for y in range(1,x+1)]) for x in range(1,10)]))

string1 = "string"
if isinstance(string1, str):
    print("%s is string" %(string1))
else:
    print("%s is not string" %(string1))


def mydef(*number):
    sum=0
    for num in number:
        sum += num
    return sum

print(mydef(1, 2, 3, 4))